IDL Programming > Objects > Graphics Object Classes > IDLgrSymbol

IDLgrSymbol

Superclasses | Creation | Properties | Methods | Version History

A symbol object represents a graphical element that is plotted relative to a particular position.

Note: Seven predefined symbols are provided by IDL.

Superclasses

None

Creation

See IDLgrSymbol::Init.

Properties

Objects of this class have the following properties. See IDLgrSymbol Properties for details on individual properties.

Methods

This class has the following methods:

In addition, this class inherits the methods of its superclasses (if any).

Examples

Creating Symbol Objects

Specify the type of symbol to use when you call the IDLgrSymbol::Init method.

To Use a Pre-defined Symbol

Specify one of the following values for the symbol type:

1

Plus sign (the default)

2

Asterisk

3

Period

4

Diamond

5

Triangle

6

Square

7

X

For example, to create a symbol object using a red triangle for the symbol, use the following statement:

mySymbol = OBJ_NEW('IDLgrSymbol', 5, COLOR=[255,0,0])

To Use a Graphic Object as a Symbol

You can use an visualization object or a model object as a symbol. For best results, create an object that fills the domain between –1 and 1 in all directions. For example, the following statements create a polygon object in the shape of a pentagon and define a symbol object to use the polygon:

pentagon=OBJ_NEW('IDLgrPolygon', [-0.8,0.0,0.8,0.4,-0.4], $

    [0.2,0.8,0.2,-0.8,-0.8], COLOR=[0,0,255])

mySymbol = OBJ_NEW('IDLgrSymbol', pentagon)

Note that we create the pentagon to fit in the plane between –1 and 1 in both the X and Y directions. We could also have created the pentagon to fit in a unit square and then scaled it to fit the domain between –1 and 1.

For example:

pentagon=OBJ_NEW('IDLgrPolygon', [0.1,0.5,0.9,0.7,0.3], $

   [0.6,0.9,0.6,0.1,0.1], COLOR=[0,0,255])

symModel = OBJ_NEW('IDLgrModel')

symModel->Add, pentagon

symModel->Scale, 2, 2, 1

symModel->Translate, -1, -1, 0

mySymbol = OBJ_NEW('IDLgrSymbol', symModel)

 

Note: We create the symbol object to use the model object rather than the polygon object. Using a model object as a symbol allows you to apply transformations to the symbol even after it has been created.

Setting Size

By default, symbols extend one unit to each side of the data point they represent. Set the SIZE property of the symbol object to a two-element vector that describes the scaling factor in X and Y to apply to the symbol to change the size of the symbols that are rendered. For example, to scale a symbol so that it extends 1/10 of a unit to each side of the data point, use the statement:

mySymbol->SetProperty, SIZE=[0.1, 0.1]

Setting Color

If you are using a pre-defined symbol, you can set its color using the COLOR property of the symbol object. If you are using a graphic object as a symbol, the symbol’s color is determined by the color of the graphic object and the setting of the COLOR property of the symbol object itself is ignored. For example, the following statement creates a symbol object that uses a red triangle:

mySymbol = OBJ_NEW('IDLgrSymbol', 5, COLOR=[255,0,0])

Version History

5.0

Introduced

6.1

Added ALPHA_CHANNEL property

6.2

Added NAME and UVALUE properties

8.0

Added ANTIALIAS, FILL_COLOR, and FILLED properties